package com.ymatou.iapi.payment.testcase;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.payment.parameter.SyncCmbPublicKeyBean;
import com.ymatou.iapi.payment.service.SyncCmbPublicKeyCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.database.sqlwapper.PayGateWayWapper;
import com.ymttest.utils.TestDataManager;
/**
*更新招行秘钥
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_SyncCmbPublicKey{
	private static SyncCmbPublicKeyBean synccmbpublickeyBean;
	private static SyncCmbPublicKeyCall synccmbpublickeyCall;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("更新招行秘钥");
	}

	@Before
	public void caseUp() {
		synccmbpublickeyBean=new SyncCmbPublicKeyBean();
		synccmbpublickeyCall=new SyncCmbPublicKeyCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(synccmbpublickeyCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	@Ignore
	//测试环境不能访问
	public void Tc_SyncCmbPublicKey_001() {
		Logger.start(true,"更新招行秘钥成功");
		try {
			PayGateWayWapper pg=new PayGateWayWapper();
			int oid=(int)pg.selectCmbpublickey().get(0).get("Id");
			synccmbpublickeyBean.setBizId(TestDataManager.getRandomUUID().toString());
			synccmbpublickeyCall.setData(synccmbpublickeyBean);
			synccmbpublickeyCall.callService();			
			Logger.verifyEquals("ok", synccmbpublickeyCall.getReturnData(), "验证return");
			int id=(int)pg.selectCmbpublickey().get(0).get("Id");
			Logger.verifyEquals(true, id>oid, "验证有新纪录");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}